#ifndef _PARTHUS_SYS_POWER_
#define _PARTHUS_SYS_POWER_

/******************************************************************************
 * MODULE NAME:    sys_power.h
 * PROJECT CODE:   BlueStream
 * DESCRIPTION:    Low Power Mode Clock Control
 * MAINTAINER:     Ivan Griffin
 * DATE:           10 December 2001
 *
 * SOURCE CONTROL: $Id: sys_power.h,v 1.5 2009/10/20 03:12:03 xiezc Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2001-2004 Ceva Inc.
 *     All rights reserved.
 *
 ******************************************************************************/

#if (PRH_BS_CFG_SYS_LOW_POWER_MODE_SUPPORTED==1)

    typedef enum {
        SYS_LF_OSC_NONE   = 0,
        SYS_LF_OSC_32K000 = 1,
        SYS_LF_OSC_32K768 = 2
    } t_sys_lf_osc_type;

    typedef enum {
         CALIB_MODE_NORMAL  = 0,
         CALIB_MODE_GUANGHUI = 1,
         CALIB_MODE_LUOFEI  = 2,
         CALIB_MODE_LILIN  = 3
     }t_sys_lf_calib_mode;
    
    /*
     * Function prototypes
     */
    void SYSpwr_Halt_System(void);
    void SYSpwr_Sleep_System(void);
    void SYSpwr_Exit_Halt_System(void);
    void SYSpwr_Force_System_Halt(void);

    void SYSpwr_Initialise(void);
    void SYSpwr_Setup_Sleep_Timer(u_int32 max_num_frames_to_sleep);
    void SYSpwr_Handle_Early_Wakeup(void);
    boolean SYSpwr_Is_Low_Power_Mode_Active(void);

    boolean SYSpwr_Set_LowFrequencyOscillatorAvailable_Value(u_int8 osc_available);
    t_sys_lf_osc_type SYSpwr_LowFrequencyOscillatorAvailable(void);
    u_int32 SYSpwr_Get_Min_Frames_To_Sleep(void);

    void SYSpwr_Set_ModuleCLK(u_int8 module_index, u_int8 enable);
    
    void SYSpwr_Set_SoftResetREG(u_int8 module_index, u_int8 enable);

    boolean SYSpwr_Check_Register_Bit(u_int32 reg_addr, u_int8 bit_num);
    void SYSpwr_Set_Register_Bit(u_int32 reg_addr, u_int8 bit_num, u_int8 value);
    void SYSpwr_use_lf_change(void);
#else
    /*
     * No sys_power, hence empty functions
     */
    #define SYSpwr_Initialise()
    #define SYSpwr_Is_Low_Power_Mode_Active()  0
#endif

#endif

